<?php include_once 'include/header.php'; ?>
<div id="content">
    <?php include_once 'include/leftsidebar.php' ?>
    <div id="cmiddle">
        <div id="content-middle">           
            <div style="margin-top:20px">
                <div  style="line-height: 36px;height:36px;border-bottom:1px solid #ccc;margin-top:30px;background: url('Images/icon/member.png') no-repeat 5px center">
                    <b style="font-size: 1.5em;padding-left:30px">Danh sách thành viên (Click vào tên để xem chi tiết)</b>
                </div> 
            </div>
            <div style="margin:10px">
                <div class="example" style="float:right">
                <a href="javascript:void(false)" class="left primary button">Xem theo ảnh lớn</a>                
                <a href="javascript:void(false)" class="right negative button">Xem theo list</a>                
                </div>
                <div style="clear: both"></div>
                <div class="load-user">
                    <?php if(isset($_GET["uid"])){ ?>
<?php foreach ($list_user_f as $row) { ?>
                    <div class="user-item" style="float:left">
                        <div style="text-align: center">
                            <img title="<?php echo $row["fullname"] ?>" class="img-border" width="128px" height="128px" src="data/avatar/<?php echo $row["avatar"] ?>" alt="<?php echo $row["fullname"] ?>"/>
                        </div>                        
                    </div>
                    <!--hien thong tin-->
                    <div style="display: block;float: left">
                        <div id="user_<?php echo $row["id"] ?>" style="width:500px;height:400px;overflow:auto;">
                            <div style="margin-top:5px;border:1px solid #ccc">
                                <div  style="line-height: 36px;height:36px;border-bottom:1px solid #ccc;margin-top:30px;background: url('Images/icon/member.png') no-repeat 5px center">
                                    <b style="font-size: 1.5em;padding-left:30px;color:#a11818">Thông tin thành viên: <?php echo $row["fullname"] ?></b>
                                </div> 
                                <?php $ngaysinh = date("d/m/Y",  strtotime("{$row["ngaysinh"]}")); ?>
                                <ul class="info-user">
                                    <li><label>Mã sinh viên: </label><?php echo $row["masv"] ?></li>
                                    <li><label>Ngày sinh: </label><?php echo $ngaysinh ?></li>
                                    <li><label>Giới tính: </label><?php echo $row["gioitinh"] ?></li>                                    
                                    <li><label>Quê quán: </label><?php echo $row["quequan"] ?></li>                                    
                                    <li><label>Email: </label><?php echo $row["email"] ?></li>
                                    <li><label>Số điện thoại: </label><?php echo $row["sodienthoai"] ?></li>
                                    <li><label>Công việc hiện tại: </label><?php echo $row["job"] ?></li>
                                    <li style="background:url('Images/icon/yahoo.png') no-repeat 2px center"><label>Yahoo: </label><?php echo $row["yahoo"] ?></li>
                                    <li style="background:url('Images/icon/skype.png') no-repeat 2px center"><label>Skype: </label><?php echo $row["skype"] ?></li>
                                    <li style="background:url('Images/icon/facebook.png') no-repeat 2px center"><label>Facebook: </label><?php echo $row["facebook"] ?></li>
                                    <li><label>Nơi ở hiện tại: </label><?php echo $row["noiohientai"] ?></li>                                    
                                </ul>                                
                            </div>

                        </div>
                    </div>
                    <div style="clear: both;padding-bottom: 5px;"></div>
                <?php } ?>
                    <?php } ?>
                </div>
            </div>
        </div>        
    </div>
    <?php include_once 'include/rightsidebar.php'; ?>
</div>
<script type="text/javascript">
    $(function(){
        <?php if(!isset($_GET["uid"]) && empty($_GET["uid"])){ ?>
        $(".load-user").load("viewavatar.php");
        <?php } ?>
        $(".viewuser").live("click",function(){
            $(".viewuser").fancybox({
            'titlePosition'		: 'inside',
            'transitionIn'		: 'none',
            'transitionOut'		: 'none'
        });
        })                  
        $(".left").click(function(){
            $(".load-user").html("<div style='text-align:center'><img src='Images/icon/loading.gif'/></div>");
            $(".load-user").load("viewavatar.php");
        })
        $(".right").click(function(){
            $(".load-user").html("<div style='text-align:center'><img src='Images/icon/loading.gif'/></div>");
            $(".load-user").load("viewlist.php");
        })
    })    
    if (document.getElementById("newpost")) {
        document.getElementById("newpost").onkeydown = function(e) {
            e = e || window.event;
            if (e.keyCode == 13) {
                if($("#newpost").val()!= ""){
                    $.ajax({
                        url:"controllers/postcontroller.php?action=addnewpost",
                        type:"POST",
                        data:$("#form-post").serialize(),
                        success:function(data){
                            if(data == true){
                                window.location = window.location;
                            }
                        }                           
                    });
                }
                return false;
            }
        };
    }
    $(function(){
        $(".newcomment").keydown(function(e){               
            e = e || window.event;            
            if (e.keyCode == 13) {
                var postid = $(this).attr("postid");
                if($(".comment_"+postid).val()!= ""){
                    $.ajax({
                        url:"controllers/commentcontroller.php?action=addnewcomment&postid="+postid,
                        type:"POST",
                        data:{content:$(".comment_"+postid).val()},
                        success:function(data){

                            $(".cm_"+postid).append(data);
                            //$(".cm_'"+postid+"' li:last").hide().slideDown("slow");
                            $(".comment-input_"+postid+" input").val("");
                        }                            
                    });
                }
            }
        })
    })
   
    /*if (document.getElementById("newpost")) {
            document.getElementById("newpost").onkeydown = function(e) {
                e = e || window.event;
                if (e.keyCode == 13) {
                    if($("#newpost").val()!= ""){
                        $.ajax({
                           url:"controllers/postcontroller.php?action=addnewpost",
                           type:"POST",
                           data:$("#form-post").serialize(),
                           success:function(data){
                             if(data == true){
                                 window.location = window.location;
                             }
                           }                           
                        });
                    }
                    return false;
                }
            };
        }*/
</script>

<?php include_once 'include/footer.php' ?>